<?php
/* -------------------------------------------------------------------------------------
* 	ID:						$Id: loginbox.php 140 2013-09-22 07:44:23Z phone.mueller@googlemail.com $
* 	Letzter Stand:			$Revision: 140 $
* 	zuletzt geaendert von:	$Author: peter $
* 	Datum:					$Date: 2013-09-22 07:44:23 +0000 (Sun, 22 Sep 2013) $
*
* 	SEO:mercari by Siekiera Media
* 	http://www.seo-mercari.de
*
* 	Copyright (c) since 2011 SEO:mercari
* --------------------------------------------------------------------------------------
* 	based on:
* 	(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
* 	(c) 2002-2003 osCommerce - www.oscommerce.com
* 	(c) 2003     nextcommerce - www.nextcommerce.org
* 	(c) 2005     xt:Commerce - www.xt-commerce.com
*
* 	Released under the GNU General Public License
* ----------------------------------------------------------------------------------- */

if (!isset($_SESSION['customer_id'])) {
	$box_smarty = new smarty;

	require_once (DIR_FS_INC.'inc.draw_password_field.php');
	$box_smarty->assign('LOGIN_LINK', href_link(FILENAME_LOGIN, '', 'SSL'));
	$box_smarty->assign('FORM_ACTION', '<form id="loginbox" method="post" action="'.href_link(FILENAME_LOGIN, 'action=process', 'SSL').'">');
	$box_smarty->assign('FIELD_EMAIL', draw_input_field('email_address', BOX_EMAIL_VALUE, 'maxlength="50" tabindex="1" id="username"'));
	$box_smarty->assign('FIELD_PWD', draw_password_field('password', '', 'maxlength="30" tabindex="2" id="password"'));
	$box_smarty->assign('BUTTON', image_submit('button_login_small.gif', IMAGE_BUTTON_LOGIN, 'id="signin_submit"'));
	$box_smarty->assign('LINK_LOST_PASSWORD', href_link(FILENAME_PASSWORD_DOUBLE_OPT, '', 'SSL'));
	$box_smarty->assign('LINK_CREATE_ACCOUNT', href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL'));
	$box_smarty->assign('FORM_END', '</form>');

} else {
	$box_smarty->assign('LOGGED_IN', true);

	$logoff_link = ' <a href="'.href_link(FILENAME_LOGOFF).'">Logout</a>';

	if($_SESSION['customer_gender'] == 'f')
		$box_smarty->assign('CUSTOMERS_NAME', sprintf(WELLCOME_BACK_FEMALE, $_SESSION['customer_last_name'], $_SESSION['customer_cid']).$logoff_link);
	elseif ($_SESSION['customer_gender'] == 'm')
		$box_smarty->assign('CUSTOMERS_NAME', sprintf(WELLCOME_BACK_MALE, $_SESSION['customer_last_name'], $_SESSION['customer_cid']).$logoff_link);
	else
		$box_smarty->assign('CUSTOMERS_NAME', WELLCOME_BACK.' Kd-NR.: '.$_SESSION['customer_cid'], $_SESSION['customer_cid'].$logoff_link);
}

$box_smarty->caching = false;
$box_smarty->assign('tpl_path', 'templates/'.CURRENT_TEMPLATE.'/');
$box_smarty->assign('html_tpl_path', CURRENT_TEMPLATE.'/html');
$box_smarty->assign('language', $_SESSION['language']);
$box_content = $box_smarty->fetch(CURRENT_TEMPLATE.'/boxes/box_login.html');
?>